import request from '@/axios'
import type { ListParams, Response } from '@/api/api'

export interface Row {
  id?: number
  name: String
  real_name: string
  mobile: string
  address: string
  acreage: string
  long: string
  lat: string
  warehouse_id: number
}
// 商品列表
export const getListGoodsApi = (data: ListParams): Promise<Response<Row>> => {
  return request.post({ url: '/warehouse/goods/list', data })
}
// 第三方列表
export const getListApi = (data: ListParams): Promise<Response<Row>> => {
  return request.post({ url: '/warehouse/list', data })
}
// 新增
export const createApi = (data: Partial<Row>): Promise<IResponse> => {
  return request.post({ url: '/warehouse/create', data })
}
// 修改
export const modifyApi = (data: Partial<Row>): Promise<IResponse> => {
  return request.post({ url: '/warehouse/modify', data })
}
// 删除
export const delApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/warehouse/del', data })
}
// 详情
export const detailsApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/warehouse/details', data })
}
// 库区列表
export const getListAreaApi = (data: ListParams): Promise<Response<Row>> => {
  return request.post({ url: '/warehouse/area/list', data })
}
// 新增
export const createAreaApi = (data: Partial<Row>): Promise<IResponse> => {
  return request.post({ url: '/warehouse/area/create', data })
}
// 删除
export const delAreaApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/warehouse/area/del', data })
}
// 库位列表
export const getListStorageApi = (data: ListParams): Promise<Response<Row>> => {
  return request.post({ url: '/warehouse/storage/list', data })
}
// 新增
export const createStorageApi = (data: Partial<Row>): Promise<IResponse> => {
  return request.post({ url: '/warehouse/storage/create', data })
}
// 删除
export const delStorageApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/warehouse/storage/del', data })
}
// 移位
export const moveStorageApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/warehouse/storage/move', data })
}
